﻿using System;
using System.Data;
using System.Collections.Generic;
using com.Model.laibendi;
namespace com.BLL.laibendi
{
    /// <summary>
    /// T_Member
    /// </summary>
    public class T_Member
    {
        private readonly com.DAL.laibendi.T_Member dal = new com.DAL.laibendi.T_Member();
        public T_Member()
        { }
        #region  Method
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool ExistsUserName(String UserName, String Passport)
        {
            return dal.ExistsUserName(UserName, Passport);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(com.Model.laibendi.T_Member model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(com.Model.laibendi.T_Member model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(long MemberId)
        {

            return dal.Delete(MemberId);
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool DeleteList(string MemberIdlist)
        {
            return dal.DeleteList(MemberIdlist);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public com.Model.laibendi.T_Member GetModel(long MemberId)
        {

            return dal.GetModel(MemberId);
        }


        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dal.GetList(Top, strWhere, filedOrder);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<com.Model.laibendi.T_Member> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<com.Model.laibendi.T_Member> DataTableToList(DataTable dt)
        {
            List<com.Model.laibendi.T_Member> modelList = new List<com.Model.laibendi.T_Member>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                com.Model.laibendi.T_Member model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new com.Model.laibendi.T_Member();
                    //model.MemberId=dt.Rows[n]["MemberId"].ToString();
                    model.UserName = dt.Rows[n]["UserName"].ToString();
                    model.Passport = dt.Rows[n]["Passport"].ToString();
                    model.Email = dt.Rows[n]["Email"].ToString();
                    model.Mobile = dt.Rows[n]["Mobile"].ToString();
                    model.Province = dt.Rows[n]["Province"].ToString();
                    model.City = dt.Rows[n]["City"].ToString();
                    model.Country = dt.Rows[n]["Country"].ToString();
                    model.Address = dt.Rows[n]["Address"].ToString();
                    model.RegisterIp = dt.Rows[n]["RegisterIp"].ToString();
                    if (dt.Rows[n]["RegisterTime"].ToString() != "")
                    {
                        model.RegisterTime = DateTime.Parse(dt.Rows[n]["RegisterTime"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  Method
    }
}

